//
//  Intro_VC.m
//  MasterUabApp
//
//  Created by Alumne on 13/10/13.
//  Copyright (c) 2013 Owlab. All rights reserved.
//

#import "Intro_VC.h"

@interface Intro_VC ()

@end

@implementation Intro_VC

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    _countAlumnos.text = @"...";
}

- (void) getCountAlumnos
{
    if (m_AlumnoArray == nil)
    {
        m_AlumnoArray = [[AlumnoArray alloc]init:self];
    }
    [ECommon showProgressInView:self.view withText:@"LOADING..."];
    [m_AlumnoArray getCountAlumnos];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void) syncDone:(BOOL)success object:(BaseObject*)obj
{
    if (success)
    {
        if ([obj isKindOfClass:[AlumnoArray class]])
        {
            [ECommon hideProgress];
            _countAlumnos.text = m_AlumnoArray.countAlumnos;
        }
    }
    else
    {
        //Show error message
        if (obj!=nil && obj.msg != nil && obj.msg.length > 0)
        {
            [ECommon setProgressDetailsLabel:obj.msg];
            [ECommon setProgressErrorAndHideWithText:NSLocalizedString(@"Problem detected:", @"")];
        }
        else
        {
            [ECommon setProgressErrorAndHideWithText:NSLocalizedString(@"Connection error", @"")];
        }
    }
}

- (IBAction)list_Clicked:(id)sender
{
    //Nothing to do.
}

- (IBAction)getCountAlumnos:(id)sender
{
    [self getCountAlumnos];
}
@end
